import { Column, Entity, Index, PrimaryColumn } from 'typeorm';
import { BaseEntity } from '../../common/base.entity';

/**
 * 插件 阿里云监控服务器  占用率
 */
@Entity(PluginAliyunMonitorEcsMetric.tableName)
export class PluginAliyunMonitorEcsMetric {

  static entityName = 'PluginAliyunMonitorEcsMetric';
  static tableName = 'plugin_aliyun_monitor_ecs_metric';

  @PrimaryColumn({ comment: 'id，格式：instanceId + t + metric + type' })
  id: string;
  @Column({ comment: '时间' })
  t: number;
  @Column({ comment: '阿里云 instanceId' })
  instanceId: number;
  @Column({ comment: '阿里云 instanceName' })
  instanceName: string;
  @Column({ comment: '最小值' })
  minimum: number;
  @Column({ comment: '平均值' })
  average: number;
  @Column({ comment: '最大值' })
  maximum: number;
  @Column({ nullable: true, comment: '指标类型，如果没有可以为空，cpu_load（load_1m,load_5m,load_15m）' })
  type: string;
  @Column({ nullable: true, comment: '指标：cpu_load（cpu负载），cpu_total（cup使用率）,memory_usedutilization（内存使用率）' })
  metric: string;

}

export const PluginAliyunMonitorEcsMetricName = {
  cpu_load:'cpu_load',
  cpu_load_1m:'load_1m',
  cpu_load_5m:'load_5m',
  cpu_load_15m:'load_15m',
  cpu_total:'cpu_total',
  memory_usedutilization:'memory_usedutilization'
};
